<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:pretty="http://ocpsoft.com/prettyfaces"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="../templates/mainTemplate.xhtml">

	<ui:define name="ajaxStatus">
	</ui:define>

	<ui:define name="content">
		<div class="box">
			<h2>
				<a id="toggle-portfolio-shares" href="#"><h:outputText
						value="#{msg['portfolioshares.portfolioShares']}" /></a>
			</h2>
			<div id="portfolio-shares" class="block tables">
				<p:ajaxStatus style="width:16px;height:16px;">
					<f:facet name="start">
						<p:graphicImage value="#{resource['img:ajaxloading.gif']}" />
					</f:facet>

					<f:facet name="complete">
						<h:outputText value="" />
					</f:facet>
				</p:ajaxStatus>

				<h:form prependId="false">
					<p:dataTable id="dataTable" var="share" widgetVar="sharesTable"
						value="#{portfolioSharesBean.shares}" paginator="true" rows="30"
						paginatorPosition="top"
						emptyMessage="#{msg['prime.noRecordsFound']}">
						<f:facet name="header">
							<p:outputPanel>
								<h:outputText value="#{msg['portfolioshares.search']}" />
								<p:inputText id="globalFilter" onkeyup="sharesTable.filter()" />
							</p:outputPanel>
						</f:facet>
						<p:columnGroup type="header">
							<p:row>
								<p:column rowspan="2" style="white-space: normal;"
									headerText="#{msg['portfolioshares.company']}"
									sortBy="#{share['name']}" filterBy="#{share['name']}"
									filterMatchMode="startsWith" filterStyle="display: none;" />
								<p:column rowspan="2" style="white-space: normal;"
									headerText="#{msg['portfolioshares.amount']}"
									sortBy="#{share['amount']}" />

								<p:column colspan="3" style="white-space: normal;"
									headerText="#{msg['portfolioshares.value']}" />

								<p:column rowspan="2" style="white-space: normal;"
									headerText="#{msg['portfolioshares.active']}"
									sortBy="#{share['active']}" />

								<p:column colspan="2" style="white-space: normal;"
									headerText="#{msg['portfolioshares.ordersAmount']}" />

								<p:column rowspan="2" style="white-space: normal;"
									headerText="#{msg['portfolioshares.lastQuotationDate']}"
									sortBy="#{share['lastQuotationDate']}" />
							</p:row>

							<p:row>
								<p:column headerText="#{msg['portfolioshares.buy']}"
									style="white-space: normal;" sortBy="#{share['spentOnShares']}" />
								<p:column headerText="#{msg['portfolioshares.current']}"
									style="white-space: normal;" sortBy="#{share['value']}" />
								<p:column headerText="#{msg['portfolioshares.difference']}"
									style="white-space: normal;" sortBy="#{share['difference']}" />

								<p:column style="white-space: normal;"
									headerText="#{msg['portfolioshares.completedOrdersAmount']}"
									sortBy="#{share['completedAmount']}" />
								<p:column style="white-space: normal;"
									headerText="#{msg['portfolioshares.canceledOrdersAmount']}"
									sortBy="#{share['canceledAmount']}" />
							</p:row>
						</p:columnGroup>

						<p:column>
							<pretty:link mappingId="companyDetails">
								<f:param value="#{share['name']}" />
								<h:outputText value="#{share['name']}" />
							</pretty:link>
						</p:column>

						<p:column>
							<h:outputText value="#{share['amount']}" />
						</p:column>

						<p:column>
							<h:outputText value="#{share['spentOnShares']}" />
						</p:column>

						<p:column>
							<h:outputText style="font-weight: bold;"
								value="#{share['value']}" />
						</p:column>

						<p:column>
							<h:outputText value="#{share['difference']}" />%
						</p:column>

						<p:column>
							<h:outputText rendered="#{share['active'] == 'YES'}"
								style="font-weight: bold; color: #348017;"
								value="#{msg['portfolioshares.yes']}" />
							<h:outputText rendered="#{share['active'] == 'NO'}"
								style="font-weight: bold; color: #F62817;"
								value="#{msg['portfolioshares.no']}" />
						</p:column>

						<p:column>
							<h:outputText value="#{share['completedAmount']}" />
						</p:column>

						<p:column>
							<h:outputText value="#{share['canceledAmount']}" />
						</p:column>

						<p:column>
							<h:outputText value="#{share['lastQuotationDate']}" />
						</p:column>

					</p:dataTable>
				</h:form>
			</div>
		</div>
	</ui:define>
</ui:composition>

</html>
